package com.ruoyi.rural.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rural.domain.AddressConfiguration;
import com.ruoyi.rural.mapper.AddressConfigurationMapper;
import com.ruoyi.rural.service.IAddressConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 地址配置Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-06
 */
@Service
public class AddressConfigurationServiceImpl implements IAddressConfigurationService 
{
    @Autowired
    private AddressConfigurationMapper addressConfigurationMapper;

    /**
     * 查询地址配置
     * 
     * @param id 地址配置主键
     * @return 地址配置
     */
    @Override
    public AddressConfiguration selectAddressConfigurationById(String id)
    {
        return addressConfigurationMapper.selectAddressConfigurationById(id);
    }

    /**
     * 查询地址配置列表
     * 
     * @param addressConfiguration 地址配置
     * @return 地址配置
     */
    @Override
    public List<AddressConfiguration> selectAddressConfigurationList(AddressConfiguration addressConfiguration)
    {
        return addressConfigurationMapper.selectAddressConfigurationList(addressConfiguration);
    }

    /**
     * 新增地址配置
     * 
     * @param addressConfiguration 地址配置
     * @return 结果
     */
    @Override
    public int insertAddressConfiguration(AddressConfiguration addressConfiguration)
    {
        addressConfiguration.setId(UUID.randomUUID().toString());
        addressConfiguration.setCreateTime(DateUtils.getNowDate());
        return addressConfigurationMapper.insertAddressConfiguration(addressConfiguration);
    }

    /**
     * 修改地址配置
     * 
     * @param addressConfiguration 地址配置
     * @return 结果
     */
    @Override
    public int updateAddressConfiguration(AddressConfiguration addressConfiguration)
    {
        addressConfiguration.setUpdateTime(DateUtils.getNowDate());
        return addressConfigurationMapper.updateAddressConfiguration(addressConfiguration);
    }

    /**
     * 批量删除地址配置
     * 
     * @param ids 需要删除的地址配置主键
     * @return 结果
     */
    @Override
    public int deleteAddressConfigurationByIds(String[] ids)
    {
        return addressConfigurationMapper.deleteAddressConfigurationByIds(ids);
    }

    /**
     * 删除地址配置信息
     * 
     * @param id 地址配置主键
     * @return 结果
     */
    @Override
    public int deleteAddressConfigurationById(String id)
    {
        return addressConfigurationMapper.deleteAddressConfigurationById(id);
    }
}
